﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace Aliyeye.Car.Net.UI.Common
{
    public class win32
    {
        /// Return Type: BOOL->int
        ///hWnd: HWND->HWND__*
        [DllImportAttribute("user32.dll", EntryPoint = "SetForegroundWindow")]
        [return: MarshalAsAttribute(UnmanagedType.Bool)]
        public static extern bool SetForegroundWindow([InAttribute()] System.IntPtr hWnd);

        /// Return Type: HWND->HWND__*
        ///hWnd: HWND->HWND__*
        [DllImportAttribute("user32.dll", EntryPoint = "SetActiveWindow")]
        public static extern System.IntPtr SetActiveWindow([InAttribute()] System.IntPtr hWnd);


        /// Return Type: LRESULT->LONG_PTR->int
        ///hWnd: HWND->HWND__*
        ///Msg: UINT->unsigned int
        ///wParam: WPARAM->UINT_PTR->unsigned int
        ///lParam: LPARAM->LONG_PTR->int
        [DllImportAttribute("user32.dll", EntryPoint = "SendMessage")]
        public static extern int SendMessage(
               int hWnd,　　　// handle to destination window 
               int Msg,　　　 // message 
               int wParam,　// first message parameter 
               int lParam // second message parameter 
         );

        [DllImportAttribute("user32.dll", EntryPoint = "FindWindow")]
        public static extern IntPtr FindWindow(string lpszClassName, string lpszWindowName);

        [DllImportAttribute("user32.dll", EntryPoint = "FindWindowEx")]
        public static extern IntPtr FindWindowEx(IntPtr hWndParent,
            IntPtr hWndChildAfter,
            [MarshalAsAttribute(UnmanagedType.LPWStr)] string lpszClass,
            [MarshalAsAttribute(UnmanagedType.LPWStr)] string lpszWindow);

        [DllImportAttribute("user32.dll", EntryPoint = "ShowWindow")]
        public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);



        [DllImportAttribute("user32.dll", EntryPoint = "EnableWindow")]
        public static extern bool EnableWindow(IntPtr hWnd, [MarshalAsAttribute(UnmanagedType.Bool)] bool bEnable);

        /// WM_CHAR -> 0x0102
        public const int WM_CHAR = 258;
        /// VK_OEM_1 -> 0xBA
        public const int VK_OEM_1 = 186;
        /// VK_OEM_2 -> 0xBF
        public const int VK_OEM_2 = 191;

        public const int zero = 0;
        public const int WM_KEYDOWN = 256;

    }
}
